package com.qingcloud.adminbackend.enums;

public enum UserStatus {

    LOGIN("1", "登录中"),
    LOGOUT("2", "退出"),
    INITIAL("3", "初始状态"),
    LOCK("4", "锁定");

    private String code;

    private String name;

    private UserStatus(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getNameByCode(String code) {
        UserStatus[] uss = values();
        for (UserStatus us : uss) {
            if (us.code.equals(code)) {
                return us.name;
            }
        }
        return null;
    }
}
